<?php
/**
 * Created by PhpStorm.
 * User: alexey
 * Date: 7/29/14
 * Time: 10:44 PM
 */

namespace util;

include_once("Logger.php");

class BrowserLogger extends Logger
{

  function info($message)
  {
    $outputMessage = "<span style='color: rgba(0,0,0, 0.6)'>";
    $outputMessage .= "[INFO] ";
    $outputMessage .= date("[d.m.y] [H:i:s] ");
    $outputMessage .= "  " . $_SERVER['SCRIPT_NAME'] . "  ";
    $outputMessage .= $message;
    $outputMessage .= "</span><br>";
    $this->write($outputMessage);
  }

  function error($message)
  {
    $outputMessage = "<span style='color: rgba(255,0,0, 0.6)'>";
    $outputMessage .= "[ERROR] ";
    $outputMessage .= date("[d.m.y] [H:i:s] ");
    $outputMessage .= $message;
    $outputMessage .= "</span><br>";
    $this->write($outputMessage);
  }

  protected function write($message)
  {
    echo $message;
  }
}